#!/bin/bash
###
 # @Author: Jeff Liu
 # @Date: 2023-07-06 17:57:47
 # @LastEditTime: 2023-10-13 22:40:24
 # @LastEditors: Jeff Liu
 # @Description: 
 # @FilePath: \ntu_interoperability\src\loader.sh
 # Jeff.liu@intersytems.com
### 
# DIR=$(dirname $0)
# if [ "$DIR" = "." ]; then
# DIR=$(pwd)
# fi
# iris-community login need no username and password

# echo " Merge configuration..." 
# iris merge iris /external/irismerge.conf /usr/irissys/iris.cpf

iris session $ISC_PACKAGE_INSTANCENAME -U USER <<- EOF
do \$SYSTEM.OBJ.Load("/dur/WebTerminal-v4.9.5.xml", "cuk")
do \$SYSTEM.OBJ.Load("/dur/zpm-0.7.0.xml", "cuk")
write "zpm and webterminal installed"
zpm
zn HCC
load -v /dur/hccns
exit
halt
EOF

echo ""
echo "Installation complete."
echo ""

echo "stop iris and purge unnecessary files..."
iris stop $ISC_PACKAGE_INSTANCENAME quietly
rm -rf $ISC_PACKAGE_INSTALLDIR/mgr/journal.log 
rm -rf $ISC_PACKAGE_INSTALLDIR/mgr/IRIS.WIJ
rm -rf $ISC_PACKAGE_INSTALLDIR/mgr/journal/*
rm -rf /dur/*

exit 0